class User < ActiveRecord::Base
  belongs_to :department
  has_many :rights , :through =>:users_rights
  has_many :users_rights
  has_many :customer_backups
  has_many :order_backups
  has_many :hotel_orders
  has_many :policies
  has_many :callers_logs
  has_many :error_infos
  
  has_many :create_orders, :class_name => 'Order', :foreign_key => 'creator_id'
  has_many :print_orders, :class_name => 'Order', :foreign_key => 'printer_id'
  has_many :cancel_orders, :class_name => 'Order', :foreign_key => 'canceler_id'
  has_many :ticket_out_orders, :class_name => 'Order', :foreign_key => 'ticket_outer_id'
  has_many :cash_check_orders, :class_name => 'Order', :foreign_key => 'cash_checker_id'
  has_many :send_orders, :class_name => 'Order', :foreign_key => 'sender_id'
  
  has_many :jj_orders, :class_name => 'Order', :foreign_key => 'jj_man_id'
  has_many :jj_affirm_orders, :class_name => 'Order', :foreign_key => 'jj_affirm_id'
  has_many :last_edit_orders, :class_name => 'Order', :foreign_key => 'last_editer_id'
  
  has_many :cancel_tickets, :class_name => 'Ticket', :foreign_key => 'canceler_id'
  has_many :insurance_out_tickets, :class_name => 'Ticket', :foreign_key => 'insurance_outer_id'
end
